/**
 * 定义会员工厂类
 * @author lty
 */
public class MemberFactory {
    // 根据用户等级创建会员对象
    public static Member createMember(String level) {
        if (level.equalsIgnoreCase("gold")) {
            return new GoldMember();
        } else if (level.equalsIgnoreCase("silver")) {
            return new SilverMember();
        } else if (level.equalsIgnoreCase("bronze")) {
            return new BronzeMember();
        }
        return null;
    }
}
